package com.cf.edu182;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class a {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        String[] in = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        in = br.readLine().split(" ");
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] =  Integer.parseInt(in[i]);
        }
        int[] prev = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            prev[i] = prev[i - 1] + a[i - 1];
        }
        for (int l = 1; l < n; l++) {
            for (int r = l + 1; r < n; r++) {
                int x1 = ((prev[l] - prev[0]) % 3 + 3) % 3;
                int x2 = ((prev[r] - prev[l]) % 3 + 3) % 3;
                int x3 = ((prev[n] - prev[r]) % 3 + 3) % 3;
                if ((x1 != x2 && x1 != x3 && x2 != x3) || (x1 == x2 && x2 == x3)) {
                    out.println(l + " " + r);
                    return;
                }
            }
        }
        out.println(0 + " " + 0);

    }
}
